package fast.mvc;

import java.awt.Color;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JList;
import javax.swing.border.LineBorder;

@SuppressWarnings("serial")
public class LoadProfileView extends JFrame{
	
	JList<String> listProfiles = new JList<String>();
	JButton cmdLoad = new JButton("Load");
	
	public LoadProfileView(String[] strings){
        super("Load Profile");
        listProfiles = new JList<String>(strings);
        
        initForm();
    }

    private void initForm(){
        this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        this.setLayout( null );
        this.setResizable(false);
        this.setBounds(200, 20, 300, 400);
        
        listProfiles.setBounds(20, 20, 255, 300);
        listProfiles.setBorder(new LineBorder(Color.BLACK));
        add(listProfiles);
        
        cmdLoad.setBounds(175, 325, 100, 25);
        add(cmdLoad);
    }
    
    public void setLoadListener(ActionListener a){
    	cmdLoad.addActionListener(a);
    }

	public String getSelectedProfile() {
		return (String) listProfiles.getSelectedValue();
	}
}
